"""
1.无序集合
2.有序集合
"""
import redis
client = redis.StrictRedis(password='123456')
# 添加数据
# client.sadd('set1', 1)
# client.sadd('set1', 1, 2, 3, 4, 5)
# 随机删除
# r = client.spop("set1")
# print(r)
# 删除指定值的元素
# r = client.srem('set1', '1, 2, 3, 4, 5')
# print(r)
# 将一个集合中的元素移动到另一个集合
# r = client.smove('set1', 'set5', 5)
# print(r)
# r = client.smembers('set5')
# print('set5', r)

# 输出数据
r = client.smembers('set1')
print('set1', r)
# 查看元素个数
r = client.scard('set1')
print('set1个数', r)

client.close()
